<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <ui:define name="title">
        wizarCita
    </ui:define>

    <ui:define name="body">
        <h:form id="CitaListForm">
            <p:panel header="#{bundle.ListCitaTitle}">
                <p:dataTable id="datalist" value="#{citaController.citaPaciente}" var="item"
                         selectionMode="single" selection="#{citaController.selected}"
                         paginator="true"
                         rowKey="#{item.idcita}"
                         rows="10"
                         rowsPerPageTemplate="10,20,30,40,50"
                         resizableColumns="true">
                    
                <p:ajax event="rowSelect"   update="createButton viewButton editButton deleteButton"/>
                <p:ajax event="rowUnselect" update="createButton viewButton editButton deleteButton"/>

                <p:column >
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListCitaTitle_fechacita}"/>
                    </f:facet>
                    <h:outputText value="#{item.fechacita}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:outputText>
                </p:column>
                <p:column resizable="false">
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListCitaTitle_detallecita}"/>
                    </f:facet>
                    <h:outputText value="#{item.detallecita}"/>
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="#{bundle.ListPacientesTitle_cedula}"/>
                    </f:facet>
                    <h:outputText value="#{item.idpaciente.cedula}"/>
                </p:column>
                <f:facet name="footer">
                    <p:commandButton id="createButton" icon="ui-icon-plus"   value="#{bundle.Create}" actionListener="#{citaController.prepareCreate}" update=":CitaCreateForm" oncomplete="PF('CitaCreateDialog').show()"/>
                    <p:commandButton id="viewButton"   icon="ui-icon-search" value="#{bundle.View}" update=":CitaViewForm" oncomplete="PF('CitaViewDialog').show()" disabled="#{empty citaController.selected}"/>
                    <p:commandButton id="editButton"   icon="ui-icon-pencil" value="#{bundle.Edit}" update=":CitaEditForm" oncomplete="PF('CitaEditDialog').show()" disabled="#{empty citaController.selected}"/>
                    <p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{bundle.Delete}" actionListener="#{citaController.destroy}" update=":growl,datalist" disabled="#{empty citaController.selected}"/>
                </f:facet>
            </p:dataTable>
            </p:panel>
        </h:form>

        <ui:include src="/wizar/cita/Create.xhtml"/>
        <ui:include src="/wizar/cita/Edit.xhtml"/>
        <ui:include src="/wizar/cita/View.xhtml"/>
    </ui:define>

</ui:composition>
